package com.tally.server.enums;

/**
 * @Author: sy
 * @Date: 2020/12/22 17:32
 * @Description:
 */
public enum IncomeTypeEnum {
    SALARY("SA","薪水"),
    SUBSIDY("SU","补贴"),
    REWARD("RE","奖金"),
    PART_TIME("PA","兼职"),
    OTHERS("OT","其它"),
    ;

    private String code;
    private String desc;

    IncomeTypeEnum(String code, String desc){
        this.code = code;
        this.desc = desc;
    }
    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDesc(String code) {
        for (IncomeTypeEnum incomeTypeEnum: IncomeTypeEnum.values()) {
            if (incomeTypeEnum.getCode().equals(code)) {
                return incomeTypeEnum.getDesc();
            }
        }
        throw new IllegalArgumentException("No results");
    }
}
